-
Notifications
You must be signed in to change notification settings - Fork 1.3k
TS strictmode ActionGroup and ActionBar #3416
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Build successful! 🎉 |
Build successful! 🎉 |
Build successful! 🎉 |
}); | ||
} | ||
|
||
const ActionBarInnerWithRef = React.forwardRef(ActionBarInner) as <T>(props: SpectrumActionBarProps<T> & {ref?: DOMRef<HTMLDivElement>}) => ReturnType<typeof ActionBarInner>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whyyyyy?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because of typescript :( this was the best interpretation of this discussion I could come up with https://stackoverflow.com/questions/58469229/react-with-typescript-generics-while-using-react-forwardref
|
||
/** Get an item by its key. */ | ||
getItem(key: Key): T, | ||
getItem(key: Key | null): T, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is null allowed here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
state.selectionManager.firstSelectedKey
can be null https://github.com/adobe/react-spectrum/blob/main/packages/%40react-spectrum/actiongroup/src/ActionGroup.tsx#L396
i think you're right, i think the better thing is to include it in the if above
Build successful! 🎉 |
Build successful! 🎉 |
Closes
✅ Pull Request Checklist:
📝 Test Instructions:
🧢 Your Project: